<?php

my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('xl_builder' , false);  
my_component_load('ap_kjk' );

define('KONSTANTA_TUNJANGAN_KJK'	,	2);

$task = isset($_GET['task']) ? $_GET['task'] : "";  
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$periode_id = isset( $_GET['periode_id'] ) ? $_GET['periode_id']:  0;


$modul_name = "Waktu Kerja _BN_ Hasil Kalkulasi _BN_ Kelebihan Jam Kerja";
ini_set("max_execution_time","10000");

if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){
		case "set_proses_page":
			$ver = set_form_validate();
			if($ver){
				$errors = message_multi_error($ver);
				$content = $errors;
				
				$content .= set_waktu_kerja_normal($page);
				generate_my_web($content, "" , 'plain.php?script=1' );
				exit;
			}else{
				proses_kjk();
				my_direct('index.php?com='.$_GET['com'].'&task=detail_set_page&t='.$t);
			}
			  
		break;
		case "upload_page":
			$ver = upload_form_validate();
			 
			if($ver){
				$errors = message_multi_error($ver);
				$content = $errors;
				$content .= upload_form_page($page);
				generate_my_web($content, "" , 'plain.php?script=1' );
				exit;
			}else{
				$t=upload_form_page_submit();
				my_direct('index.php?com='.$_GET['com'].'&task=detail_upload_page&t='.$t);
			}
		break;
	}
else: 	
	
	/*if($task == "detail_set_page"){ 
		$content ="Updated!!";
		generate_my_web($content, "" , 'plain.php' );
		exit;  	
	}elseif($task == "detail_upload_page"){ 
		$content ="Uploaded!!";
		generate_my_web($content, "" , 'plain.php' );
		exit;  	
	}elseif($task == "set_proses"){ 	 
		$title= "Proses data KJK"; 
		facebox_page('index.php?com='.$_GET['com'].'&task=set_proses_page' , $title , 250	); 
	}elseif($task == "upload"){ 	 
		$title= "Upload data KJK"; 
		facebox_page('index.php?com='.$_GET['com'].'&task=upload_page&id='.$id , $title , 250	); 
	}elseif($task == "upload_page"){
		generate_my_web(upload_kjk_form_page(), "" , 'plain.php' );
		exit; 
	 }elseif($task == "rst"){
		 my_query('TRUNCATE TABLE temp_tmn_kjk');
		 my_direct($_SERVER['HTTP_REFERER']);	 
	}else
	
	
	elseif($task =="set_proses_page"){
		$content = set_waktu_kerja_normal(); 
		generate_my_web($content, "" , 'plain.php' );
		exit;
	}elseif($task =="edit_page"){
		$content = form_upload_view_create($komponen_gaji_id,$id); 
		generate_my_web($content, "" , 'plain.php' );
		exit;
	}
	 */
	 
	 if($task =="excel_report"){
		header("Content-Type: application/xls");
		header("Content-Disposition: attachment;filename=hasil_kalkulasi_KJK.xls");
		echo excel_kjk_kalkulasi(  );
		exit;
	}else{
		$pagename = $modul_name;
		load_facebox_script(); 
		$content =  list_karyawan_kjk( $periode_id);
	
	}
endif;  
generate_my_web($content, $pagename );
